/**
 * Copyright(c): 2017 com.mjduan All rights reserved.
 * 项目名：learn-spring-web
 * 注意：未经作者允许，不得外传
 */
package com.mjduan.project.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author dmj1161859184@126.com 2018-07-27 15:49
 * @version 1.0
 * @since 1.0
 */
public class HelloServlet extends HttpServlet {
    private static final Logger LOGGER = LoggerFactory.getLogger(HelloServlet.class);

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doProcess(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doProcess(req,resp);
    }

    private void doProcess(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        System.out.println("xxxxmjduan");
        LOGGER.info("Receive a request");
        resp.getWriter().write("Hello world");
        resp.getWriter().flush();
    }
}
